package com.chess.echo.session;

import java.net.SocketAddress;

import com.chess.manager.GameServerManager;
import com.sojoys.artifact.factory.session.ISession;

import io.netty.channel.Channel;

public class EchoSession implements ISession {

	protected Channel channel;


	public EchoSession(Channel channel) {
		super();
		this.channel = channel;
	}

	// ----------------------------------------
	@Override
	public Object getId() {
		return channel.id().asShortText();
	}

	@Override
	public <T> T getAttribute(Object key) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setAttribute(String key, Object value) {
		// TODO Auto-generated method stub

	}

	@Override
	public void removeAttribute(Object key) {
		// TODO Auto-generated method stub

	}

	@Override
	public SocketAddress localAddress() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public SocketAddress remoteAddress() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Object getIoChannel() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setIoChannel(Object ioChannel) {
		// TODO Auto-generated method stub

	}

	@Override
	public int[] getEncryptionKeys() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int[] getDecryptionKeys() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void close() {
		GameServerManager.removeCache(getId().toString());
		channel.close();
	}

	@Override
	public void sendMessage(Object msg) {
		
	}
}
